package solved;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

/*
 ID:	liluyan1
 LANG:	JAVA
 TASK:	namenum
 */
public class namenum {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader(new FileReader("namenum.in"));
		String n = f.readLine();
		List<String> sat = new namenum().name(n);
		
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(
				"namenum.out")));
		for (String s : sat) {
			out.println(s);
		}
		if (sat.size() == 0) out.println("NONE");
		out.close();
		System.exit(0);
	}
	
	private List<String> name(String s) throws IOException {
		BufferedReader f = new BufferedReader(new FileReader("dict.txt"));
		String line;
		long n = Long.parseLong(s);
		
		ArrayList<String> lines = new ArrayList<String>();
		while ((line = f.readLine()) != null) {
			line = line.trim();
			if (line.length() == s.length() && score(line) == n) {
				lines.add(line);
			}
		}
		return lines;
	}
	
	private long score(String line) {
		long n = 0;
		for (char c : line.toCharArray()) {
			int t = score(c);
			if (t < 0) return -1;
			n = n * 10 + t;
		}
		return n;
	}
	
	private int score(char c) {
		if (c < 'Q') return (c - 'A')/3 + 2;
		if (c == 'Q' || c == 'Z') return -1;
		return (c - 'Q')/3 + 7;
	}
}
